package com.shine.icis.hbean;

/**
 * ETL运行日志
 */
import java.io.Serializable;

import com.shine.icis.util.Tools;

public class ChkRunLog implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 2415088348566987884L;
	
	
	public static final char RUN_STATUS_START = '1';//开始
	public static final char RUN_STATUS_SUCCESS = '2';//成功
	public static final char RUN_STATUS_FAILURE = '3';//失败
	
	public static final int PREP_LEVEL_ID_ERROR = 1;//错误级别ID
	public static final int PREP_LEVEL_ID_WARN = 2;//警告级别ID、
	public static final int PREP_LEVEL_ID_INFO = 3;//信息级别ID
	
	private	Long logID;
	private	Integer prepLevelID;//警告级别ID
	private	Integer etlProcID;//过程ID
	private	Integer procNo;//存储过程No
	private	int operDate;
	private	int operTime;
	private    char runStatus;//任务运行状态:1表示开始，2表示成功，3表示失败
	private	String resultMsg;//提示信息
	
	public Long getLogID() {
		return logID;
	}

	public void setLogID(Long logID) {
		this.logID = logID;
	}

	public Integer getPrepLevelID() {
		return prepLevelID;
	}
	
	
	public void setPrepLevelID(Integer prepLevelID) {
		this.prepLevelID = prepLevelID;
	}

	public Integer getEtlProcID() {
		return etlProcID;
	}
	
		
	public void setEtlProcID(Integer etlProcID) {
		this.etlProcID = etlProcID;
	}

	public Integer getProcNo() {
		return procNo;
	}
	
	public void setProcNo(Integer procNo) {
		this.procNo = procNo;
	}

	public int getOperDate() {
		return operDate;
	}

	public void setOperDate(int operDate) {
		this.operDate = operDate;
	}

	public int getOperTime() {
		return operTime;
	}

	public void setOperTime(int operTime) {
		this.operTime = operTime;
	}

	public char getRunStatus() {
		return runStatus;
	}

	public void setRunStatus(char runStatus) {
		this.runStatus = runStatus;
	}

	public String getResultMsg() {
		return resultMsg;
	}

	public void setResultMsg(String resultMsg) {
		this.resultMsg = resultMsg;
	}

	public String getFormatOperDate() {
		//20100909 -> 2010-09-09
		StringBuffer sb = new StringBuffer();
		sb.append(operDate);
		if (sb.length() != 8) {
			return "";
		}
		return sb.insert(6, "-").insert(4, "-").toString();
	}
	
	public String getFormatOperTime() {
		//121200 -> 12:12:00
		StringBuffer sb = new StringBuffer();
		sb.append(Tools.getFixedNum(operTime, 6));
		return sb.insert(4, ":").insert(2, ":").toString();
	}
	public String getRunStatusText(){
		if(runStatus == '1'){
			return "开始";
		}else if(runStatus == '2'){
			return "成功";
		}else{
			return "失败";
		}
	}
	public String getPrepLevelText(){
		if(prepLevelID == 1){
			return "错误";
		}else if(prepLevelID == 2){
			return "警告";
		}else{
			return "信息";
		}
	}
	public String getEtlProcText(){
		if(etlProcID == 0){
			return "股份数据核对自动任务";
		}else if(etlProcID == 1){
			return "股份数据抽取";
		}else if (etlProcID == 2){
			return "股份数据预处理";
		}else if (etlProcID == 3){
			return "股份数据核对";
		}else{
			return "股份数据归档";
		}
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((logID == null) ? 0 : logID.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ChkRunLog other = (ChkRunLog) obj;
		if (logID == null) {
//			if (other.logID != null)
				return false;
		} else if (!logID.equals(other.logID))
			return false;
		return true;
	}
	
}
